package com.headingdata.string;

import java.util.Scanner;

public class StringTest4 {

    public static void main(String[] args) {
        //登录demo
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入用户名：");
            String username = scanner.next();
            System.out.println("请输入用户密码：");
            String password = scanner.next();
            if(login(username,password)){
                System.out.println("恭喜您,登录成功！");
                break;
            }else {
                System.out.println("用户名密码错误！请重新输入！");
            }
        }

    }

    public static boolean login(String username,String password){
        String okUsername = "headingdata";
        String okPassword = "hdi$8888";
        return username.equals(okUsername) && password.equals(okPassword);
    }
}
